package shin

import (
	"local.public/innerpkg/logger"
	"local.public/innerpkg/mqtool"
	"local.public/utils"
)

type Wav2lipReq struct {
	FrameworkName    string `json:"framework_name,omitempty"`
	GenerateKind     string `json:"generate_kind,omitempty"` // pic2video、video2video
	CoverPath        string `json:"cover_path,omitempty"`
	VtuberPath       string `json:"vtuber_path,omitempty"`
	FacePath         string `json:"face_path,omitempty"`
	AudioPath        string `json:"audio_path,omitempty"`
	TaskDbId         int    `json:"task_dbid,omitempty"`
	MemberId         int    `json:"member_id,omitempty"`
	OutFilenameShort string `json:"outfile_filename_short,omitempty"`
}

type SadTalkerReq struct {
	FrameworkName    string `json:"framework_name,omitempty"`
	GenerateKind     string `json:"generate_kind,omitempty"` // pic2video
	CoverPath        string `json:"cover_path,omitempty"`
	VtuberPath       string `json:"vtuber_path,omitempty"`
	FacePath         string `json:"face_path,omitempty"`
	AudioPath        string `json:"audio_path,omitempty"`
	TaskDbId         int    `json:"task_dbid,omitempty"`
	MemberId         int    `json:"member_id,omitempty"`
	OutFilenameShort string `json:"outfile_filename_short,omitempty"`
}

type SovitsVoiceCloneReq struct {
	FrameworkName    string `json:"framework_name,omitempty"`
	GenerateKind     string `json:"generate_kind,omitempty"` // sovits
	AudioPath        string `json:"audio_path,omitempty"`
	TaskDbId         int    `json:"task_dbid,omitempty"`
	MemberId         int    `json:"member_id,omitempty"`
	InputParams      string `json:"input_params,omitempty"`
	OutFilenameShort string `json:"outfile_filename_short,omitempty"`
}

func SendMq4GenVideoReq(frameworkName string, req *Wav2lipReq) error {
	topic := "workeradmin.genvideo." + frameworkName
	payload := utils.Struct2Json(*req)
	logger.Debug("Send mq msg,for " + frameworkName + " 发送nats消息,subject:" + topic + " payload:" + payload)
	return mqtool.MqSend(topic, payload)
}

func SendMq4Wav2lipReq(req *Wav2lipReq) error {
	topic := "workeradmin.genvideo.wav2lip"
	payload := utils.Struct2Json(*req)
	logger.Debug("SendMq4Wav2lipReq 发送nats消息,subject:" + topic + " payload:" + payload)
	return mqtool.MqSend(topic, payload)
}

func SendMq4SadtalkerReq(req *SadTalkerReq) error {
	topic := "workeradmin.genvideo.sadtalker"
	payload := utils.Struct2Json(*req)
	logger.Debug("SendMq4SadtalkerReq 发送nats消息,subject:" + topic + " payload:" + payload)
	return mqtool.MqSend(topic, payload)
}

func SendMq4SovitsReq(req *SovitsVoiceCloneReq) error {
	topic := "workeradmin.genaudio.sovits"
	payload := utils.Struct2Json(*req)
	logger.Debug("SendMq4SovitsReq 发送nats消息,subject:" + topic + " payload:" + payload)
	return mqtool.MqSend(topic, payload)
}
